package models;
 
import java.util.List;
import java.util.Map;

import javax.persistence.Entity;

import play.data.validation.Required;
import siena.Model;
import siena.Table;
import siena.embed.EmbeddedMap;
 

@EmbeddedMap
public class Tag extends BasicModel implements Comparable<Tag> {
 

    
    public static Tag findOrCreateByName(String title) {
        Tag tag = Tag.getByKey(Tag.class, title);
        if(tag == null) {
            tag = new Tag();
            tag.title = title ;
        }
        return tag;
    }
    
    
    public int compareTo(Tag otherTag) {
        return title.compareTo(otherTag.title);
    }
 
}